package com.coco.common.exception;

import lombok.Getter;

/**
 * @Author: guofeng
 * @Date: 2021/07/18/19:03
 * @Description:
 */
@Getter
public enum ErrorEnum {
    // 数据操作错误定义
    NO_PERMISSION(403,"你没得权限"),
    NO_AUTH(401,"你能不能先登录一下"),
    NO_NullPointer(4555,"控制在异常"),
    NOT_FOUND(404, "未找到该资源!"),
    INTERNAL_SERVER_ERROR(500, "服务器跑路了"),
    BARGAIN_RANDOM_PARAMETER(1001,"随机金额算法参数校验失败"),
    BARGAIN_RANDOM_NUMBER(1002,"随机金额算法总金额不足以生成指定随机金额数量"),
    BARGAIN_RANDOM_TOTAL_PRICE(1003,"随机生成砍价金额数量与设置不符"),
    BARGAIN_RANDOM_MIN_PRICE(1004,"生成随机砍价金额异常：剩余金额不满足剩余人数最小金额"),
    BARGAIN_HELP_USER(1200,"参数异常"),
    BARGAIN_ALREADY_HELP_USER(1201,"已经帮助好友砍过了，不能在砍了"),
    BARGAIN_CONNECTION_TIME_OUTS(1202,"此链接已不存在"),


    /*无效的文件类型*/
    INVALID_FILE_TYPE(400, "无效的文件类型！"),
    /*无效的请求参数*/
    INVALID_PARAM_ERROR(400, "无效的请求参数！"),
    /*无效的手机号码*/
    INVALID_PHONE_NUMBER(400, "无效的手机号码"),
    /*验证码错误*/
    INVALID_VERIFY_CODE(400, "验证码错误！"),
    /*无效的用户名和密码*/
    INVALID_USERNAME_PASSWORD(400, "无效的用户名和密码！"),
    /*无效的服务id和密钥*/
    INVALID_SERVER_ID_SECRET(400, "无效的服务id和密钥！"),
    /*回调参数有误*/
    INVALID_NOTIFY_PARAM(400, "回调参数有误！"),
    /*回调签名有误*/
    INVALID_NOTIFY_SIGN(400, "回调签名有误！"),
    /*商品分类不存在*/
    /*商品分类不存在*/
    CATEGORY_NOT_FOUND(404, "商品分类不存在！"),
    /*品牌不存在*/
    BRAND_NOT_FOUND(404, "品牌不存在！"),
    /*规格不存在*/
    SPEC_NOT_FOUND(404, "规格不存在！"),
    /*商品不存在*/
    GOODS_NOT_FOUND(404, "商品不存在！"),
    /*购物车不存在*/
    CARTS_NOT_FOUND(404, "购物车不存在！"),
    /*应用不存在*/
    APPLICATION_NOT_FOUND(404, "应用不存在！"),
    /*订单不存在*/
    ORDER_NOT_FOUND(404, "订单不存在！"),
    /*订单数据不存在*/
    ORDER_DETAIL_NOT_FOUND(404, "订单数据不存在！"),
    /*数据转换异常*/
    DATA_TRANSFER_ERROR(500, "数据转换异常！"),
    /*新增操作失败*/
    INSERT_OPERATION_FAIL(500, "新增操作失败！"),
    /*更新操作失败*/
    UPDATE_OPERATION_FAIL(500, "更新操作失败！"),
    /*删除操作失败*/
    DELETE_OPERATION_FAIL(500, "删除操作失败！"),
    /*文件上传失败*/
    FILE_UPLOAD_ERROR(500, "文件上传失败！"),
    /*目录写入失败*/
    DIRECTORY_WRITER_ERROR(500, "目录写入失败！"),
    /*文件写入失败*/
    FILE_WRITER_ERROR(500, "文件写入失败！"),
    /*短信发送失败*/
    SEND_MESSAGE_ERROR(500, "短信发送失败！"),
    /*订单状态不正确*/
    INVALID_ORDER_STATUS(500, "订单状态不正确！"),
    /*库存不足*/
    STOCK_NOT_ENOUGH_ERROR(500, "库存不足！"),
    /*登录失效或未登录*/
    UNAUTHORIZED(401, "登录失效或未登录！"),
    /*操作成功*/
    OPERATE_SUCCESSFULLY(200, "上传成功!"),
    /*添加成功*/
    ADD_SUCCESSFULLY(200, "添加成功!"),
    /* 修改成功  */
    UPDATE_SUCCESSFULLY(200, "修改成功"),
    /*删除成功*/
    DELETE_SUCCESSFULLY(200, "删除成功"),
    /* 操作成功 */
    OPERATOR_SUCCESSFULLY(200, "操作成功"),
    /* token不存在*/
    TOKEN_LOSE_EFFICACY(403, "token失效");

    /** 错误码 */
    private Integer errorCode;

    /** 错误信息 */
    private String errorMsg;

    ErrorEnum(Integer errorCode, String errorMsg) {
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }
}